package com.shiro.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class RouterController {
    @RequestMapping({"/", "/index"})
    public String toIndex(Model model) {
        model.addAttribute("msg", "hello shiro");
        return "index";
    }

    @RequestMapping("/user/addUser")
    public String toAddUser() {
        return "/user/addUser";
    }

    @RequestMapping("/user/updateUser")
    public String toUpdateUser() {
        return "/user/updateUser";
    }

    @RequestMapping("/tologin")
    public String toLogin() {
        return "login";
    }

    @ResponseBody
    @RequestMapping("/unauth")
    public String unauth() {
        return "未经授权无法访问";
    }
}
